package net.haiyue.api.repository;
import net.haiyue.api.entity.Module;
import net.haiyue.api.entity.SelectInfo;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

@Transactional
public interface ModuleRepository extends BaseRepository<Module,Integer> {

    @Query(value = "SELECT * FROM modules where pid=?1",nativeQuery = true)
     List<Module> findByProjectId(int id);
    @Query(value = "SELECT DISTINCT id as value,name as label FROM modules where pid=?1",nativeQuery = true)
    List<SelectInfo> selectModule(int id);
}
